import request from '@/utils/request'

//  https://api-hmzs.itheima.net/v1/parking/card/list

/**
 * 查看月卡信息列表
 */
export function getCardListAPI(params) {
  return request({
    url: '/parking/card/list',
    params
  })
}

/**
 *  添加月卡
 * https://api-hmzs.itheima.net/v1/parking/card
 */
export function createCardAPI(data) {
  return request({
    url: '/parking/card',
    method: 'POST',
    data
  })
}

/**
 * 获取月卡编辑详情
 *  https://api-hmzs.itheima.net/v1/parking/card/detail/{id}
 */

export function monthlycardAPI(id) {
  return request({
    url: `/parking/card/detail/${id}`
  })
}

/**
 *  编辑月卡
 *  https://api-hmzs.itheima.net/v1/parking/card/edit
 */
export function updateCardAPI(data) {
  return request({
    url: '/parking/card/edit',
    method: 'put',
    data
  })
}

/**
 *  https://api-hmzs.itheima.net/v1/parking/card/{ids}
 * 删除月卡
 */
export function deleteCardAPI(id) {
  return request({
    url: `/parking/card/${id}`,
    method: 'DELETE'
  })
}
